package com.wlyuan.open.scanner.service;

import com.wlyuan.open.scanner.repository.FinanceBillRepository;
import com.wlyuan.open.scanner.repository.PayRepository;
import com.wlyuan.open.scanner.repository.WayBillRepository;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

/**
 * @author lijing
 * @description
 */
@Service
@Slf4j
@RequiredArgsConstructor
public class InitService {
    private final PayRepository payRepository;
    private final WayBillRepository wayBillRepository;
    private final FinanceBillRepository financeBillRepository;

    @Async("asyncExecutor")
    public void pay() {
        payRepository.init();
    }

    @Async("asyncExecutor")
    public void waybill() {
        wayBillRepository.init();
    }

    @Async("asyncExecutor")
    public void bill() {
        financeBillRepository.init();
    }

    @Async("asyncExecutor")
    public void waybillTime(String startTime, String endTime) {
        wayBillRepository.initTime(startTime, endTime);
    }

    @Async("asyncExecutor")
    public void billTime(String startTime, String endTime) {
        financeBillRepository.initTime(startTime, endTime);
    }

    @Async("asyncExecutor")
    public void payTime(String startTime, String endTime) {
        payRepository.initTime(startTime, endTime);
    }
}
